package com.zhiyou100.loans.service.impl;

import com.zhiyou100.loans.dao.RechargeDao;
import com.zhiyou100.loans.dao.impl.RechargeDaoImpl;
import com.zhiyou100.loans.model.Recharge;
import com.zhiyou100.loans.model.Result;
import com.zhiyou100.loans.service.RechargeService;
import com.zhiyou100.loans.util.NetDate;

import net.sf.json.JSONObject;

public class RechargeServiceImpl implements RechargeService {
	RechargeDao rd = new RechargeDaoImpl();
	@Override
	public JSONObject addRecharge(String money, String userid) {
		Recharge rech = new Recharge();
		rech.setMoney(Double.parseDouble(money));
		rech.setType(1);
		rech.setUserid(Integer.parseInt(userid));
		rech.setRechargetime(NetDate.getCurrentTime());
		int i = rd.addRecharge(rech);
		Result result = new Result(false, "充值记录添加失败");
		if(i>0){
			result.setFlag(true);
			result.setMessage("种植记录添加成功");
		}
		return JSONObject.fromObject(result);
	}

}
